from .handle import handle

class orderHandle(handle):
    def __init__(self):
        super(orderHandle, self).__init__()

    def get_goods_order(self):
        url = self._base_url + "management/order"
        return self._handle(url=url, htype="GET")

    def goods_deliver(self, order_no, express_company, express_number):
        url = self._base_url + "management/goods_deliver"
        data = {
            "out_trade_no": order_no,
            "name": express_company,
            "express_number": express_number
        }

        return self._handle(url=url, data=data)

    def change_order_status(self, order_no, status, order_type="", goods_id=0):
        url = self._base_url + "management/alter_order_status"

        data = {
            "out_trade_no": order_no,
            "status": status,
            "order_type": order_type,
            "id": goods_id
        }

        return self._handle(url=url, data=data)

    def get_group_number_data(self):
        url = self._base_url + "management/group_number"

        return self._handle(url=url, htype="GET")

    def alter_delivery_fee(self, order_no, delivery_fee):
        url = self._base_url + "management/alter_delivery_fee"

        data = {
            "out_trade_no": order_no,
            "delivery_fee": delivery_fee
        }

        return self._handle(url=url, data=data)


def main():
    orderhandle = orderHandle()
    #res = orderhandle.get_goods_order()
    #res = orderhandle.get_land_order()
    res = orderhandle.goods_deliver(1, "3423535235", "16519651965196")
    print(res)

if __name__ == '__main__':
    main()
